package cn.ncupyh.GuessNum;

import javax.swing.*;
import java.awt.*;

public abstract class GuessNumSwing {
    private Component button;

    public void go() {
        int number = (int) (Math.random() * 10);
        int guess;
        do {
            print("输入数字：");
            JOptionPane.showInternalInputDialog(button,"Message");
            guess = nextInt();
        } while(guess != number);
        println("猜中了");
    }

    public abstract void print(String text);
    public abstract void println(String text);
    public abstract int nextInt();
}
